from selenium import webdriver


def open_browser(browser="chrome"):
    if browser == "chrome":
        # 实例化配置项
        options = webdriver.ChromeOptions()
        # 准备配置项
        user_data_dir = r'--user-data-dir=C:\Users\戴尔\AppData\Local\Google\Chrome\User Data'
        # 添加参数
        options.add_argument(user_data_dir)
        browser = webdriver.Chrome(options=options)
        return browser

    elif browser == "firefox":
        return webdriver.Firefox()
    elif browser == "edge":
        return webdriver.Edge()
    else:
        print("不支持该浏览器,请选择:chrome,firefox,edge")
